package javango.contrib.admin.api;

import javango.core.User;
import javango.db.Manager;
import javango.forms.Form;

public interface ModelAdmin {

	String getVerboseName();
	ModelAdmin setVerboseName(String verboseName);
	
	String[] getListfilter();
	ModelAdmin setListFilter(String... listFilter);
	
	Form getForm();
	ModelAdmin setForm(Form form);
	
	String[] getFields();
	ModelAdmin setFields(String... fields);

	String[] getListDisplay();
	ModelAdmin setListDisplay(String... listDisplay);

	
	Form getSearchForm();
	ModelAdmin setSearchForm(Form form);
	
	String[] getListSearchFields();
	ModelAdmin setListSearchFields(String... listSearchFields);

	Manager<?> getManager();
	ModelAdmin setManager(Manager<?> manager);

	String getListDisplayLinks();
	ModelAdmin setListDisplayLinks(String listDisplayLinks);

	String getChangeFormTemplate();
	ModelAdmin setChangeFormTemplate(String changeFormTemplate);
	
	String getChangeListTemplate();
	ModelAdmin setChangeListTemplate(String changeListTemplate);
	
	String getSearchFormTemplate();
	ModelAdmin setSearchFormTemplate(String searchFormTemplate);
	
	String getConfirmDeleteTemplate();
	ModelAdmin setConfirmDeleteTemplate(String confirmDeleteTemplate);
	
	String getReaderRole();
	ModelAdmin setReaderRole(String role);
	
	String getAuthorRole();
	ModelAdmin setAuthorRole(String role);
	
	String getEditorRole();
	ModelAdmin setEditorRole(String role);
	
	// is the user authorized to any functions on this model?
	// shortcut for isauthor || isreader || ideditor
	boolean isAuthorized(User user);
	
	// can the user create 
	boolean isAuthor(User user);
	
	// can the user view
	boolean isReader(User user);
	
	// can the user view/edit/create
	boolean isEditor(User user);
	
//	ModelAdmin setActions(AdminAction... actions);
//	AdminAction[] getActions();
	
	// tools that are displayed on the object list screen and act on the entire list. (excel export)
	ModelAdmin setListTools(AdminAction... actions);
	AdminAction[] getListTools();
	
	ModelAdmin setOrderBy(String... orderBy);
	String[] getOrderBy();
	
}